package t111207;

import teams.ucmTeam.Behaviour;
import teams.ucmTeam.RobotAPI;

public class Blocker extends Behaviour{
	@Override
	public void configure() {
	// No hacemos nada
	}
	@Override
	public int takeStep() {
		myRobotAPI.setSteerHeading(myRobotAPI.getOpponentsGoal().t);
		myRobotAPI.setSpeed(1.0);
		if(myRobotAPI.canKick()){
			myRobotAPI.kick();
		
		}
		if(myRobotAPI.getOpponentsGoal().r<0.2){
			myRobotAPI.blockGoalKeeper();
			myRobotAPI.setSteerHeading(myRobotAPI.getClosestOpponent().t);
			myRobotAPI.setSpeed(1.0);
		}
	return RobotAPI.ROBOT_OK;
	}
	@Override
	public void onInit(RobotAPI r) {
	r.setDisplayString("BlockerBehaviour");
	}
	@Override
	public void end() {
	// No hacemos nada
	}
	@Override
	public void onRelease(RobotAPI r) {
	// No hacemos nada
	}
}


